home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Lib / entry.stk < prev    next >
Encoding:
Text File  |  1996-07-02  |  17.0 KB  |  546 lines

  1. ;;;;
  2. ;;;; Entries bindings and procs
  3. ;;;;
  4. ;;;; Copyright ⌐ 1993-1996 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
  5. ;;;; 
  6. ;;;; Permission to use, copy, and/or distribute this software and its
  7. ;;;; documentation for any purpose and without fee is hereby granted, provided
  8. ;;;; that both the above copyright notice and this permission notice appear in
  9. ;;;; all copies and derived works.  Fees for distribution or use of this
  10. ;;;; software or derived works may only be charged with express written
  11. ;;;; permission of the copyright holder.  
  12. ;;;; This software is provided ``as is'' without express or implied warranty.
  13. ;;;;
  14. ;;;; This software is a derivative work of other copyrighted softwares; the
  15. ;;;; copyright notices of these softwares are placed in the file COPYRIGHTS
  16. ;;;;
  17. ;;;;
  18. ;;;;           Author: Erick Gallesio [eg@unice.fr]
  19. ;;;;    Creation date: 17-May-1993 12:35
  20. ;;;; Last file update:  2-Jul-1996 13:00
  21. ;;;;
  22.  
  23. ;; ----------------------------------------------------------------------
  24. ;; Class bindings for entry widgets.
  25. ;; ----------------------------------------------------------------------
  26.  
  27.  
  28. ;;-------------------------------------------------------------------------
  29. ;; Elements of tkPriv that are used in this file:
  30. ;;
  31. ;; after-id -        If non-null, it means that auto-scanning is underway
  32. ;;            and it gives the "after" id for the next auto-scan
  33. ;;            command to be executed.
  34. ;; mouse-moved -    Non-zero means the mouse has moved a significant
  35. ;;            amount since the button went down (so, for example,
  36. ;;            start dragging out a selection).
  37. ;; press-x -        X-coordinate at which the mouse button was pressed.
  38. ;; select-mode -    The style of selection currently underway:
  39. ;;            char, word, or line.
  40. ;; x, y -        Last known mouse coordinates for scanning
  41. ;;            and auto-scanning.
  42. ;;-------------------------------------------------------------------------
  43. (let()
  44.  
  45. ;;
  46. ;; Utilities
  47. ;;
  48. (define (Tk:word-character c)
  49.   (or (char-alphabetic? c)
  50.       (char-numeric? c)
  51.       (char=? c #\-)
  52.       (char=? c #\*)))
  53.  
  54. (define (Tk:word-separator c)
  55.   (not (Tk:word-character c)))
  56.  
  57. (define (Tk:end-of-word str index . separator)
  58.   (let ((len (string-length str))
  59.     (sep (if (null? separator) Tk:word-separator separator)))
  60.     (let loop ((i index))
  61.       (cond
  62.          ((= len 0)            0)
  63.          ((>= i len)             len)
  64.      ((sep (string-ref str i))    (if (= index i) (+ i 1) i))
  65.      (ELSE                (loop (+ i 1)))))))
  66.  
  67. (define (Tk:beginning-of-word str index . separator)
  68.   (let ((len (string-length str))
  69.     (sep (if (null? separator) Tk:word-separator separator)))
  70.     (let loop ((i index))
  71.       (cond
  72.          ((= len 0)            0)
  73.          ((= i -1)             0)
  74.      ((>= i len)            (loop (- len 1)))
  75.      ((sep (string-ref str i))     (if (= index i) i (+ i 1)))
  76.      (ELSE                 (loop (- i 1)))))))
  77.  
  78. ;; Tk:entry-clipboard-keysyms
  79. ;; This procedure is invoked to identify the keys that correspond to
  80. ;; the "copy", "cut", and "paste" functions for the clipboard.
  81. ;;
  82. ;; Arguments:
  83. ;; copy -    Name of the key (keysym name plus modifiers, if any,
  84. ;;        such as "Meta-y") used for the copy operation.
  85. ;; cut -        Name of the key used for the cut operation.
  86. ;; paste -    Name of the key used for the paste operation.
  87.  
  88. (define (Tk:entry-clipboard-keysyms copy cut paste)
  89.   (define-binding "Entry" copy (|W|)
  90.     (when (equal? [selection 'own :displayof |W|] (widget->string |W|))
  91.        (clipboard 'clear :displayof |W|)
  92.        (catch 
  93.       (clipboard 'append :displayof |W| (selection 'get :displayof |W|)))))
  94.  
  95.   (define-binding "Entry" cut (|W|)
  96.     (when (equal? [selection 'own :displayof |W|] (widget->string |W|))
  97.        (clipboard 'clear :displayof |W|)
  98.        (catch
  99.       (clipboard 'append :displayof |W| (selection 'get :displayof |W|))
  100.       (|W| 'delete 'sel.first 'sel.last))))
  101.  
  102.   (define-binding "Entry" paste (|W|)
  103.     (catch
  104.        (|W| 'insert 'insert (selection 'get :displayof |W| 
  105.                             :selection "CLIPBOARD"))))
  106. )
  107.  
  108. ;; Tk:entry-button-1 --
  109. ;; This procedure is invoked to handle button-1 presses in "Entry"
  110. ;; widgets.  It moves the insertion cursor, sets the selection anchor,
  111. ;; and claims the input focus.
  112. ;;
  113. ;; Arguments:
  114. ;; w -        The "Entry" window in which the button was pressed.
  115. ;; x -        The x-coordinate of the button press.
  116.  
  117. (define (Tk:entry-button-1 w x)
  118.   (let ((pos (format #f "@~A" x)))
  119.     (set! tk::select-mode "char")
  120.     (set! tk::mouse-moved #f)
  121.     (set! tk::press-x x)
  122.     (w 'icursor (Tk:entry-closest-gap w x))
  123.     (w 'selection 'from 'insert)
  124.     (if (equal? (tk-get w :state) "normal")
  125.     (focus w))))
  126.  
  127. ;; Tk:entry-mouse-select --
  128. ;; This procedure is invoked when dragging out a selection with
  129. ;; the mouse.  Depending on the selection mode (character, word,
  130. ;; line) it selects in different-sized units.  This procedure
  131. ;; ignores mouse motions initially until the mouse has moved from
  132. ;; one character to another or until there have been multiple clicks.
  133. ;;
  134. ;; Arguments:
  135. ;; w -        The "Entry" window in which the button was pressed.
  136. ;; x -        The x-coordinate of the mouse.
  137.  
  138. (define (Tk:entry-mouse-select w x)
  139.   (let* ((cur    (Tk:entry-closest-gap w x))
  140.      (anchor (w 'index 'anchor)))
  141.  
  142.     (if (or (equal? cur anchor)  
  143.         (>= (abs (- tk::press-x x)) 3))
  144.     (set! tk::mouse-moved #t))
  145.  
  146.     (cond
  147.       ((string=? tk::select-mode "char")
  148.                (if tk::mouse-moved
  149.             (cond
  150.               ((< cur anchor) (w 'selection 'range cur anchor))
  151.               ((> cur anchor) (w 'selection 'range anchor cur))
  152.               (ELSE          (w 'selection 'clear)))))
  153.       ((string=? tk::select-mode "word")
  154.                 (if (< cur (w 'index 'anchor))
  155.             (w 'selection 'range 
  156.                (Tk:beginning-of-word (w 'get) cur)
  157.                (Tk:end-of-word       (w 'get) (- anchor 1)))
  158.             (w 'selection 'range 
  159.                (Tk:beginning-of-word (w 'get) anchor)
  160.                (Tk:end-of-word       (w 'get) (- cur 1)))))
  161.       ((string=? tk::select-mode "line")
  162.             (w 'selection 'range 0 'end)))
  163.  
  164.     (update 'idletasks)))
  165.  
  166.  
  167. ;; Tk:entry-auto-scan --
  168. ;; This procedure is invoked when the mouse leaves an "Entry" window
  169. ;; with button 1 down.  It scrolls the window left or right,
  170. ;; depending on where the mouse is, and reschedules itself as an
  171. ;; "after" command so that the window continues to scroll until the
  172. ;; mouse moves back into the window or the mouse button is released.
  173. ;;
  174. ;; Arguments:
  175. ;; w -    The "Entry" window.
  176.  
  177. (define (Tk:entry-auto-scan w)
  178.   (when (winfo 'exists w)
  179.     (let ((x tk::x))
  180.       (if (>= x  (winfo 'width w))
  181.       (begin
  182.         (w 'xview 'scroll 2 'units)
  183.         (Tk:entry-mouse-select w x))
  184.       (if (< x 0)
  185.           (w 'xview 'scroll -2 'units)
  186.           (Tk:entry-mouse-select w x)))
  187.       
  188.       (set! tk::after-id (after 50 (lambda ()
  189.                      (Tk:entry-auto-scan w)))))))
  190.  
  191. ;; Tk:entry-key-select --
  192. ;; This procedure is invoked when stroking out selections using the
  193. ;; keyboard.  It moves the cursor to a new position, then extends
  194. ;; the selection to that position.
  195. ;;
  196. ;; Arguments:
  197. ;; w -        The "Entry" window.
  198. ;; new -    A new position for the insertion cursor (the cursor hasn't
  199. ;;        actually been moved to this position yet).
  200.  
  201. (define (Tk:entry-key-select w new)
  202.   (if (w 'selection 'present)
  203.       (w 'selection 'adjust new)
  204.       (begin
  205.     (w 'selection 'from 'insert)
  206.     (w 'selection 'to new)))
  207.   (w 'icursor new))
  208.  
  209. ;; Tk:entry-Insert --
  210. ;; Insert a string into an "Entry" at the point of the insertion cursor.
  211. ;; If there is a selection in the "Entry", and it covers the point of the
  212. ;; insertion cursor, then delete the selection before inserting.
  213. ;;
  214. ;; Arguments:
  215. ;; w -    The "Entry" window in which to insert the string
  216. ;; s -        The string to insert (usually just a single character)
  217.  
  218. (define (Tk:entry-insert w s)
  219.   (unless (equal? s "")
  220.      (let ((insert (w 'index 'insert)))
  221.        (catch
  222.        (if (and (<= (w 'index 'sel.first) insert)
  223.             (>= (w 'index 'sel.last)  insert))
  224.            (w 'delete 'sel.first 'sel.last))))
  225.      (w 'insert 'insert s)
  226.      (Tk:entry-see-insert w)))
  227.  
  228. ;; Tk:entry-backspace --
  229. ;; Backspace over the character just before the insertion cursor.
  230. ;; If backspacing would move the cursor off the left edge of the
  231. ;; window, reposition the cursor at about the middle of the window.
  232. ;;
  233. ;; Arguments:
  234. ;; w -        The "Entry" window in which to backspace.
  235.  
  236. (define (Tk:entry-backspace w)
  237.   (if (w 'selection 'present)
  238.       (w 'delete 'sel.first 'sel.last)
  239.       (let ((x (- (w 'index 'insert) 1)))
  240.     (if (>= x 0) (w 'delete x))
  241.     (when (>= (w 'index "@0") 
  242.           (w 'index 'insert))
  243.       (let* ((range (w 'xview))
  244.          (left  (car range))
  245.          (right (cadr range)))
  246.         (w 'xview 'moveto (- left (/ (- right left) 2.0))))))))
  247.  
  248. ;; Tk:entry-see-insert --
  249. ;; Make sure that the insertion cursor is visible in the "Entry" window.
  250. ;; If not, adjust the view so that it is.
  251. ;;
  252. ;; Arguments:
  253. ;; w -        The "Entry" window.
  254.  
  255. (define (Tk:entry-see-insert w)
  256.   (let ((c    (w 'index 'insert))
  257.     (left (w 'index "@0")))
  258.     
  259.     (if (> left c)
  260.     (w 'xview c)
  261.     (let ((x (winfo 'width w)))
  262.       (while (and (<= (w 'index (format #f "@~A" x)) c)
  263.               (< left c))
  264.          (set! left (+ left 1))
  265.          (w 'xview left))))))
  266.  
  267. ;; Tk:entry-set-cursor -
  268. ;; Move the insertion cursor to a given position in an "Entry".  Also
  269. ;; clears the selection, if there is one in the "Entry", and makes sure
  270. ;; that the insertion cursor is visible.
  271. ;;
  272. ;; Arguments:
  273. ;; w -        The "Entry" window.
  274. ;; pos -    The desired new position for the cursor in the window.
  275.  
  276. (define (Tk:entry-set-cursor w pos)
  277.   (w 'icursor pos)
  278.   (w 'selection 'clear)
  279.   (Tk:entry-see-insert w))
  280.  
  281. ;; Tk:entry-Transpose -
  282. ;; This procedure implements the "transpose" function for "Entry" widgets.
  283. ;; It tranposes the characters on either side of the insertion cursor,
  284. ;; unless the cursor is at the end of the line.  In this case it
  285. ;; transposes the two characters to the left of the cursor.  In either
  286. ;; case, the cursor ends up to the right of the transposed characters.
  287. ;;
  288. ;; w -        The "Entry" window.
  289.  
  290. (define (Tk:entry-transpose w)
  291.   (let ((i (w 'index 'insert)))
  292.     (if (< i (w 'index 'end))
  293.     (set! i (+ i 1)))
  294.     (let ((first (- i 2)))
  295.       (if (>= first 0)
  296.       (let* ((str (w 'get))
  297.          (new (string (string-ref str (- i 1)) (string-ref str first))))
  298.         (w 'delete first i)
  299.         (w 'insert 'insert new)
  300.         (Tk:entry-see-insert w))))))
  301.  
  302. ;; Tk:entry-closest-gap --
  303. ;; Given x and y coordinates, this procedure finds the closest boundary
  304. ;; between characters to the given coordinates and returns the index
  305. ;; of the character just after the boundary.
  306. ;;
  307. ;; w -        The entry window.
  308. ;; x -        X-coordinate within the window.
  309.  
  310. (define (Tk:entry-closest-gap w x)
  311.   (let* ((pos  (w 'index (format #f "@~A" x)))
  312.      (bbox (w 'bbox pos)))
  313.     (if (< [- x (list-ref bbox 0)] (/ (list-ref bbox 2) 2))
  314.     pos
  315.     (+ pos 1))))
  316.  
  317.  
  318. ;; Tk:entry-paste --
  319. ;; This procedure sets the insertion cursor to the current mouse position,
  320. ;; pastes the selection there, and sets the focus to the window.
  321. ;;
  322. ;; w -        The entry window.
  323. ;; x -        X position of the mouse.
  324.  
  325. (define (Tk:entry-paste w x)
  326.   (w 'icursor (Tk:entry-closest-gap w x))
  327.   (catch (w 'insert 'insert (selection 'get :displayof w)))
  328.   (if (string=? (tk-get w :state) "normal")
  329.       (focus w)))
  330.  
  331. ;;-------------------------------------------------------------------------
  332. ;; The code below creates the default class bindings for entries.
  333. ;;-------------------------------------------------------------------------
  334.  
  335. ;; Standard Motif bindings:
  336.  
  337.  
  338.  
  339. ;;-------------------------------------------------------------------------
  340. ;; The code below creates the default class bindings for entries.
  341. ;;-------------------------------------------------------------------------
  342.  
  343. ;; Standard Motif bindings:
  344.  
  345. (define-binding "Entry" "<1>" (|W| x)
  346.   (Tk:entry-button-1 |W| x)
  347.   (|W| 'selection 'clear))
  348.  
  349. (define-binding "Entry" "<B1-Motion>" (|W| x)
  350.   (set! tk::x x)
  351.   (Tk:entry-mouse-select |W| x))
  352.  
  353. (define-binding "Entry" "<Double-1>" (|W| x)
  354.   (set! tk::select-mode "word")
  355.   (Tk:entry-mouse-select |W| x)
  356.   (catch 
  357.      (|W| 'icursor 'sel.first)))
  358.  
  359. (define-binding "Entry" "<Triple-1>" (|W| x)
  360.   (set! tk::select-mode "line")
  361.   (Tk:entry-mouse-select |W| x)
  362.   (|W| 'icursor 0))
  363.  
  364. (define-binding "Entry" "<Shift-1>" (|W| x)
  365.   (set! tk::select-mode "char")
  366.   (|W| 'selection 'adjust (format #f "@~A" x)))
  367.  
  368. (define-binding "Entry" "<Double-Shift-1>" (|W| x)
  369.   (set! tk::select-mode "word")
  370.   (Tk:entry-mouse-select |W| x))
  371.  
  372. (define-binding "Entry" "<Triple-Shift-1>" (|W| x)
  373.   (set! tk::select-mode "line")
  374.   (Tk:entry-mouse-select |W| x))
  375.  
  376. (define-binding "Entry" "<B1-Leave>" (|W| x)
  377.   (set! tk::x x)
  378.   (Tk:entry-auto-scan |W|))
  379.  
  380. (define-binding "Entry" "<B1-Enter>" ()
  381.   (Tk:cancel-repeat))
  382.  
  383. (define-binding "Entry" "<ButtonRelease-1>" ()
  384.   (Tk:cancel-repeat))
  385.  
  386. (define-binding "Entry" "<Control-1>" (|W| x)
  387.   (|W| 'icursor (format #f "@~A" x)))
  388.  
  389.  
  390. (define-binding "Entry" "<Left>" (|W|)
  391.   (Tk:entry-set-cursor |W| (- (|W| 'index 'insert) 1)))
  392.  
  393. (define-binding "Entry" "<Right>" (|W|)
  394.   (Tk:entry-set-cursor |W| (+ (|W| 'index 'insert) 1)))
  395.  
  396. (define-binding "Entry" "<Shift-Left>" (|W|)
  397.   (Tk:entry-key-select |W| (- (|W| 'index 'insert) 1))
  398.   (Tk:entry-see-insert |W|))
  399.  
  400. (define-binding "Entry" "<Shift-Right>" (|W|)
  401.   (Tk:entry-key-select |W| (+ (|W| 'index 'insert) 1))
  402.   (Tk:entry-see-insert |W|))
  403.  
  404. (define-binding "Entry" "<Control-Left>" (|W|)
  405.   (Tk:entry-set-cursor |W|
  406.                (Tk:beginning-of-word (|W| 'get) 
  407.                          (- (|W| 'index 'insert) 1))))
  408.  
  409. (define-binding "Entry" "<Control-Right>" (|W|)
  410.   (Tk:entry-set-cursor |W| (Tk:end-of-word (|W| 'get) (|W| 'index 'insert))))
  411.  
  412. (define-binding "Entry" "<Shift-Control-Left>" (|W|)
  413.   (Tk:entry-key-select |W|
  414.             (Tk:beginning-of-word (|W| 'get) 
  415.                          (- (|W| 'index 'insert) 1)))
  416.   (Tk:entry-see-insert |W|))
  417.  
  418. (define-binding "Entry" "<Shift-Control-Right>" (|W|)
  419.   (Tk:entry-key-select |W| (Tk:end-of-word (|W| 'get) (|W| 'index 'insert)))
  420.   (Tk:entry-see-insert |W|))
  421.  
  422. (define-binding "Entry" "<Home>" (|W|)
  423.   (Tk:entry-set-cursor |W| 0))
  424.  
  425. (define-binding "Entry" "<Shift-Home>" (|W|)
  426.   (Tk:entry-key-select |W| 0)
  427.   (Tk:entry-see-insert |W|))
  428.  
  429. (define-binding "Entry" "<End>" (|W|)
  430.   (Tk:entry-set-cursor |W| 'end))
  431.  
  432. (define-binding "Entry" "<Shift-End>" (|W|)
  433.   (Tk:entry-key-select |W| 'end)
  434.   (Tk:entry-see-insert |W|))
  435.  
  436. (define-binding "Entry" "<Delete>" (|W|)
  437.   (if (|W| 'selection 'present)
  438.       (|W| 'delete 'sel.first 'sel.last)
  439.       (|W| 'delete 'insert)))
  440.  
  441. (define-binding "Entry" "<BackSpace>" (|W|)
  442.   (Tk:entry-backspace |W|))
  443.  
  444. (define-binding "Entry" "<Control-space>" (|W|)
  445.   (|W| 'selection 'from 'insert))
  446.  
  447. (define-binding "Entry" "<Select>" (|W|)
  448.   (|W| 'selection 'from 'insert))
  449.  
  450. (define-binding "Entry" "<Control-Shift-space>" (|W|)
  451.   (|W| 'selection 'adjust 'insert))
  452.  
  453. (define-binding "Entry" "<Shift-Select>" (|W|)
  454.   (|W| 'selection 'adjust 'insert))
  455.  
  456. (define-binding "Entry" "<Control-slash>" (|W|)
  457.   (|W| 'selection 'range 0 'end))
  458.  
  459. (define-binding "Entry" "<Control-backslash>" (|W|)
  460.   (|W| 'selection 'clear))
  461.  
  462. (Tk:entry-clipboard-keysyms "<F16>" "<F20>" "<F18>")
  463.  
  464. (define-binding "Entry" "<KeyPress>" (|W| |A|)
  465.   (Tk:entry-Insert |W| |A|))
  466.  
  467.  
  468. ;; Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
  469. ;; Otherwise, if a widget binding for one of these is defined, the
  470. ;; <KeyPress> class binding will also fire and insert the character,
  471. ;; which is wrong.  Ditto for Escape, Return, and Tab.
  472. (let ((nop (lambda () '())))
  473.   (bind "Entry" "<Alt-KeyPress>"     nop)
  474.   (bind "Entry" "<Meta-KeyPress>"     nop)
  475.   (bind "Entry" "<Control-KeyPress>"     nop)
  476.   (bind "Entry" "<Escape>"         nop)
  477.   (bind "Entry" "<Return>"         nop)
  478.   (bind "Entry" "<KP_Enter>"         nop)
  479.   (bind "Entry" "<Tab>"         nop))
  480.  
  481.  
  482. (define-binding "Entry" "<Insert>" (|W|)
  483.   (catch 
  484.     (Tk:entry-insert |W| (selection 'get :displayof |W|))))
  485.  
  486. ;; Additional emacs-like bindings:
  487.  
  488. (define-binding "Entry" "<Control-a>" (|W|)
  489.   (Tk:entry-set-cursor |W| 0))
  490.  
  491. (define-binding "Entry" "<Control-b>" (|W|)
  492.   (Tk:entry-set-cursor |W| (- (|W| 'index 'insert) 1)))
  493.  
  494. (define-binding "Entry" "<Control-d>" (|W|)
  495.   (|W| 'delete 'insert))
  496.  
  497. (define-binding "Entry" "<Control-e>" (|W|)
  498.   (Tk:entry-set-cursor |W| 'end))
  499.  
  500. (define-binding "Entry" "<Control-f>" (|W|)
  501.   (Tk:entry-set-cursor |W| (+ (|W| 'index 'insert) 1)))
  502.  
  503. (define-binding "Entry" "<Control-h>" (|W|)
  504.   (Tk:entry-backspace |W|))
  505.  
  506. (define-binding "Entry" "<Control-k>" (|W|)
  507.   (|W| 'delete 'insert 'end))
  508.  
  509. (define-binding "Entry" "<Control-t>" (|W|)
  510.   (Tk:entry-transpose |W|))
  511.  
  512. (define-binding "Entry" "<Meta-b>" (|W|)
  513.  (Tk:entry-set-cursor |W|
  514.                (Tk:beginning-of-word (|W| 'get) 
  515.                          (- (|W| 'index 'insert) 1))))
  516.  
  517. (define-binding "Entry" "<Meta-d>" (|W|)
  518.   (|W| 'delete 'insert (Tk:end-of-word (|W| 'get) (|W| 'index 'insert))))
  519.  
  520. (define-binding "Entry" "<Meta-f>" (|W|)
  521.   (Tk:entry-set-cursor |W| (Tk:end-of-word (|W| 'get) (|W| 'index 'insert))))
  522.  
  523. (define-binding "Entry" "<Meta-BackSpace>" (|W|)
  524.   (|W| 'delete (Tk:beginning-of-word (|W| 'get) (- (|W| 'index 'insert) 1))
  525.        'insert))
  526.  
  527. (Tk:entry-clipboard-keysyms "<Meta-w>" "<Control-w>" "<Control-y>")
  528.  
  529.  
  530. ;; A few additional bindings of my own.
  531.  
  532. (define-binding "Entry" "<Shift-2>" (|W| x)
  533.   (|W| 'scan 'mark x)
  534.   (set! tk::x x)
  535.   (set! tk::mouse-moved #f))
  536.  
  537. (define-binding "Entry" "<Shift-B2-Motion>" (|W| x)
  538.   (if (> (abs (- x tk::x)) 2)
  539.       (set! tk::mouse-moved #t))
  540.   (|W| 'scan 'dragto x))
  541.  
  542. (define-binding "Entry" "<ButtonRelease-2>" (|W| x)
  543.   (when (or *tk-strict-Motif* (not tk::mouse-moved))
  544.     (Tk:entry-paste |W| x)))
  545. )
  546.